# 全局配置加载器

import os
import yaml
from pathlib import Path

# 获取项目根目录
PROJECT_ROOT = Path(__file__).parent.parent.parent

# 加载基础配置
with open(PROJECT_ROOT / 'src/configs/base_config.yaml') as f:
    base_config = yaml.safe_load(f)

# 将相对路径转换为绝对路径
for section in ['data', 'training']:
    if section in base_config:
        for key, value in base_config[section].items():
            if isinstance(value, str) and not os.path.isabs(value):
                base_config[section][key] = str(PROJECT_ROOT / value)

__all__ = ['base_config']